package com.tywj.panda.driver.route

import android.app.Activity
import com.tywj.panda.customer.common.view.paging.BasePagingFragmentSearch
import com.tywj.panda.driver.details.DriverBusDetailsActivity
import com.tywj.panda.driver.details.DriverPassengerFragment
import com.tywj.panda.driver.details.DriverRouteFragment
import com.tywj.panda.driver.entity.DriverTaskEntity
import com.tywj.panda.driver.task.DriverTaskFragment
import com.tywj.lib.core.common.view.BaseFragment
import com.tywj.lib.route.RouteNavigation
import com.tywj.panda.driver.more.DriverMoreTaskActivity


/**
 * @desc 司机端路由组件
 * @author June Yang
 * @date 2020/6/20
 */
object DriverRoute {
    // 司机端首页
    const val DRIVER_HOME = "/Driver/home"

    //用户
    const val DRIVER_USER = "/Driver/user"

    //班次详情
    const val DRIVER_TASK_DETAILS = "/Driver/taskDetails"

    // 司机端首页组件服务
    const val DRIVER_SERVICE = "/Driver/Homeservice"

    //任务完成情况
    const val DRIVER_TASK = "/Driver/task"

    //班次详情
    const val DRIVER_TASK_PASSENGER = "/Driver/Passenger"

    const val DRIVER_TASK_ROUTE = "/Driver/Route"

    //查看绩效
    const val DRIVER_PERFORM = "/Driver/Performance"

    //设置
    const val USER_SETTINGS = "/Driver/settings"

    //关于我们
    const val USER_ABOUT = "/Driver/about"

    //验票码
    const val DRIVER_CHECK_CODE = "/Driver/checkCode"

    //用户反馈
    const val USER_FEEDBACK = "/Driver/FeedBack"

    //更多班次
    const val DRIVER_MORE_TASK = "/Driver/moreTask"


    /**
     * 获取首页Fragment
     */
    fun getDriverHomeFragment(activity: Activity): BaseFragment {
        return RouteNavigation(DRIVER_HOME)
            .navigation(activity) as BaseFragment
    }


    /**
     * 获取我的Fragment
     */
    fun getDriverUSerFragment(activity: Activity): BaseFragment {
        return RouteNavigation(DRIVER_USER)
            .navigation(activity) as BaseFragment
    }

    fun getDriverTaskFragment(activity: Activity, type: String): BasePagingFragmentSearch<*, *> {
        return RouteNavigation(DRIVER_TASK)
            .param(DriverTaskFragment.PARAMS_TASK_TYPE, type)
            .navigation(activity) as BasePagingFragmentSearch<*, *>
    }

    /**
     * 乘客信息
     */
    fun getDriverPassengerFragment(activity: Activity, bean: DriverTaskEntity.DataBean): BaseFragment {
        return RouteNavigation(DRIVER_TASK_PASSENGER).param(DriverPassengerFragment.PARAMS_TASK_ENTITY, bean)
            .navigation(activity) as BaseFragment
    }

    /**
     * 行驶路线
     */
    fun getDriverRouteFragment(activity: Activity, bean: DriverTaskEntity.DataBean): BaseFragment {
        return RouteNavigation(DRIVER_TASK_ROUTE).param(DriverRouteFragment.PARAMS_TASK_ENTITY, bean)
            .navigation(activity) as BaseFragment
    }


    //到关于我们
    fun toAboutUs(): RouteNavigation {
        return RouteNavigation(USER_ABOUT)
    }


    //到更多班次
    fun toMoreTask(date: String): RouteNavigation {
        return RouteNavigation(DRIVER_MORE_TASK).param(DriverMoreTaskActivity.PARAMS_DATE, date)
    }


    /**
     * 到验票码
     */
    fun toCheckCode(): RouteNavigation {
        return RouteNavigation(DRIVER_CHECK_CODE)
    }

    fun toBusDetails(bean: DriverTaskEntity.DataBean): RouteNavigation {
        return RouteNavigation(DRIVER_TASK_DETAILS).param(DriverBusDetailsActivity.PARAMS_TASK_ENTITY, bean)
    }


    //到绩效查看
    fun toPerformance(): RouteNavigation {
        return RouteNavigation(DRIVER_PERFORM)
    }
}